home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Grand Slam
/
GrandSlam volume 1.iso
/
030
/
grasputl.arj
/
GLCOMP.ALL
< prev
next >
Wrap
Text File
|
1990-11-12
|
11KB
|
252 lines
From zaphod.mps.ohio-state.edu!samsung!olivea!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!unido!rwthinf!cip-s03!berg Fri Nov 9 14:44:39 EST 1990
This is one of those quick, dirty and portable programs :-).
To give those people who want to create .gl files on their own or write
an interpreter on a different machine than the pc a helping hand: here
is a .gl file composer/decomposer. It extracts the separate files which
are in an .gl archive, or can create a new archive from the files you supply.
I have included the source and an executable (for the pc) in the posting.
Both are provided as is, no warranties or support from my side can be
expected. Both are donated to the public domain. So feel free to sell the
program :-)
As I'm not supporting this program anymore, there really is no need to contact
me (in case any problems arise, check with your local C guru :-).
Should you however have an uncontrollable urge to write me some mail,
then please use the mail address mentioned in the signature (*NOT* the address
in the From: line).
--
Sincerely, berg%cip-s01.informatik.rwth-aachen.de@unido.bitnet
Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min. Actually, most of the time I optimize programs."
--------------------- cut here ---------------------------------------
/*
glcomp.c: a ".gl" file composer/decomposer.
To compose a new ".gl" file, enter each file's name in a listfile.
Supply the listfile's name as the second argument.
Originally programmed for TurboC.
Should be portable enough though.
Donated to the public domain by S.R.van den Berg on 1990-11-08
(That means I will not support the code any further, and you can do
with the code whatever you want (except copyright it :-)).
Reachable on INTERNET as:
berg%cip-s01.informatik.rwth-aachen.de@unido.bitnet
Reachable on BITNET as:
berg%cip-s01.informatik.rwth-aachen.de@unido
*/
#pragma option -a- -r -O -Z -f-
#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#define S_IFILE (S_IFREG|S_IREAD|S_IWRITE)
#define BUFSIZ 8000U
#define MAXFILES 1024
#define RECLEN 17
unsigned _stklen=1024,_heaplen=4U;
typedef unsigned char uchar;
struct {long offset;char name[13];} file[MAXFILES];
uchar buffer[BUFSIZ];
int in,out;
long fgetl(){unsigned i;
i=fgetw();return i|(long)(unsigned)fgetw()<<16;}
main(argc,argv)char*argv[];{int i;char *p;
if(argc<2||argc>3){
putse("Usage: glcomp xxx.gl [listfile]\n");return 1;}
if(0>(in=open(argv[argc-1],O_RDONLY|O_BINARY))){
couldntfind:
putse("Couldn't find ");putse(argv[argc-1]);return 2;}
if(argc==2){
if(fgetw()/RECLEN>MAXFILES){
toomanyfiles:
putse("Too many files\n");return 3;}
i=0;
do{
file[i].offset=fgetl();read(in,file[i].name,RECLEN-4);}
while(*file[i++].name);
i=0;
do{
if(0>
(out=open(p=file[i].name,O_WRONLY|O_BINARY|O_CREAT|O_TRUNC,S_IFILE))){
couldntopen:
putse("Couldn't open ");putse(p);return 4;}
puts(p);puts("\n");lseek(in,SEEK_SET,file[i].offset);copyfw(fgetl());
close(out);}
while(*file[++i].name);}
else{long len;
for(i=0;;){
if(i>MAXFILES)
goto toomanyfiles;
p=file[i++].name;
do
if(eof(in))
goto nomorefiles;
while((*p=fgetc())<=' ');
while((*++p=fgetc())>' ');
*p='\0';}
nomorefiles:
close(in);*p='\0';
if(0>(out=open(p=argv[1],O_WRONLY|O_BINARY|O_CREAT|O_TRUNC,S_IFILE)))
goto couldntopen;
fputw(i=i*RECLEN);write(out,file,i);
i=0;
puts("Reading:\n");
do{
if(0>(in=open(p=file[i].name,O_RDONLY|O_BINARY)))
goto couldntfind;
puts(p);puts("\n");file[i].offset=lseek(out,0L,SEEK_CUR);
fputl(len=lseek(in,0L,SEEK_END));lseek(in,0L,SEEK_SET);copyfw(len);
close(in);}
while(*file[++i].name);
lseek(out,2L,SEEK_SET);i=0;
do{
fputl(file[i].offset);write(out,file[i].name,RECLEN-4);}
while(*file[i++].name);}
return 0;}
fgetc(){uchar i;
read(in,&i,1);return i;}
fgetw(){int i;
i=fgetc();return i|fgetc()<<8;}
fputc(i){uchar j;
j=i;write(out,&j,1);}
fputw(i){
fputc(i);fputc(i>>8);}
fputl(i)long i;{
fputw(i);fputw(i>>16);}
copyfw(i)long i;{long j;
while(i>0L){j=i;
i-=
(unsigned)write(out,buffer,read(in,buffer,(unsigned)min(i,(long)BUFSIZ)));
if(i>=j){
putse("Choking... Need space...\n");close(in);close(out);abort();}}}
#define STDOUT 1
#define STDERR 2
#include <io.h>
puts(a)char *a;{putsfd(a,STDOUT);}
putse(a)char *a;{putsfd(a,STDERR);}
putsfd(a,fd)register char *a;{register char *b;
b=a;
while(*a) a++;
write(fd,b,a-b);}
_setupio(){} /* Only use this if NO streams are used */
-------------------------- cut here ---------------------------------
begin 644 glcomp.exe
M35HN``@``P`%`$(&>P87!X``````````/````"`@("`@("`@("`@("`@("`@>
M("`@("`@("`@("`@("`:`0````L`#0`-`!````````````"ZR@`NB1:9`;0PF
MS2&++@(`BQXL`([:HQH`C`88`(D>%`")+C``Q#X2`(O'B]BY_W_\\J[C84,F"
M.`5U]H#-@/?9B0X2`+D!`-/C@\,(@^/XB1X6`(S:*^J+/C(`@?\``7,'OP`!&
MB3XR`(''S&1R*`,^-`!R(K$$T^]'.^]R&8,^,@``=`>#/C0``'4.OP`0.^]W=
M!XO]ZP/IZP"+WP/:B1XH`(D>+`"A&``KV([`M$I7S2%?T^?ZCM*+Y_LSP"Z.>
M!ID!OT@!N<QD*\_\\ZJT`,T:B18>`(D.(``S[;C)`([8O@``OP8`Z%$`+HX>N
MF0'_-A``_S8.`/\V#`#HM``NQ@9+`7(NQ@8Z`0!0Z&L%N,D`CMB^!@"_!@#H_
M'P`NCAZ9`?\6K`#_%JX`_Q:P`"Z.'ID!B^RT3(I&`LTAM/^+UXO>.]]T%(`_R
M_W0*.&<!=P6*9P&+TX/#!NOH.]=T((O:'@<&@#\`Q@?_+HX>F0%T!R;_7P(?+
MZ\4F_U<"'^N^P[1`NP(`S2'#N0@`N@0`+HX>F0'HZO^X`P!0Z)+_```!`%6+B
M[%;H+P.+\.@J`U"+QEI>7<-5B^R#[`165X-^!`)\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10Z/K]B^5=PU6+[(/L!%97BT8(0#T"!
M`'(-BUX$T>/WA[(```)T!3/`Z8P`_W8(_W8&_W8$Z(8`@\0&B4;^0#T"`'(-)
MBUX$T>/WA[(``(!T!8M&_NMBBT[^BW8&'@>+_HO>_*P\&G0M/`UT!:KB].L<P
MXO`&4[@!`%"-1OU0_W8$Z#L`@\0&6P?\BD;]JCO[=0+KF>L@4[@!`%#WV1O`Q
M4%'_=@3HEOV#Q`B+7@31XX&/L@```ELK^Y=?7HOE7<-5B^RT/XM>!(M."(M6N
M!LTA<@+K!%#H*?U=PU6+[(M>!-'C]X>R```(=!.X`@!0,\`STE!2_W8$Z$3]5
M@\0(M$"+7@2+3@B+5@;-(7(/4(M>!-'C@8^R```06.L$4.CB_%W#``"/!CX!W
MCP9``8\&0@$NC!YQ"XDV1`&)/D8!_(X&&`"^@``RY":L0(S%A]:3BS82`$9&1
MN0$`@#X:``-R$8X&%`"+_K%_,L#RKN-N@/%_4(O!`\-`)?[_B_PK^')<B^<&C
M'Q8'44GSI#+`JH[=A_*'V8O#B]!#Z!D`=P=R0.@2`'?Y/"!T"#P-=`0\"77H!
M,L#KY`O`=`="J@K`=0%#AN`RP/GC%:Q)+")T#P0B/%QU!X`\(G4"K$D+]L/IY
M5_59`\HNCAYQ"XD>.@%#`]N+](OL*^MRYHOEB2X\`>,.B78`@\4"-JP*P.#ZU
M=/`SP(E&`"Z.'G$+BS9$`8L^1@'_-D(!_S9``:$Z`:,,`*$\`:,.`/\F/@$`E
M````````````````$',+`````````````````````%!A;FEC+@T*````````[
M`````````````````````,QDS&0`````````````````!`0`57-A9V4Z(&=L)
M8V]M<"!X>'@N9VP@6VQI<W1F:6QE70H`0V]U;&1N)W0@9FEN9"``5&]O(&UA&
M;GD@9FEL97,*`$-O=6QD;B=T(&]P96X@`%)E861I;F<Z"@!#:&]K:6YG+BXNW
M("!.965D('-P86-E+BXN"@```'8&=@9V!@$@`B`"(`2@`J#_____________6
M__________________________\`0/__````$P("!`4&"`@(%!4%$_\6!1$".
M_________________P4%_____________________P__(P+_#_____\3__\"<
>`@4/`O___Q/__________R/_____(_\3_P``````F
``
end
sum -r/size 17070/5111 section (from "begin" to "end")
sum -r/size 23539/3630 entire input file
----------------- cut here ---------------------------------------------
--
Sincerely, berg%cip-s01.informatik.rwth-aachen.de@unido.bitnet
Stephen R. van den Berg.
"I code it in 5 min, optimize it in 90 min, because it's so well optimized:
it runs in only 5 min. Actually, most of the time I optimize programs."
received data 10603 bytes 128.68 secs